import React, { useState, useTransition } from "react";

export default function Index() {
  const [isPending, startTransition] = useTransition();

  const [count, setCount] = useState(6);

  function changeCount() {
    startTransition(() => {
      setCount((c) => c + 1);
    });
  }

  return (
    <>
      <div>useTransition</div>
      <div>{isPending && <div>加载中……………………………………</div>}</div>
      <p>count:{count}</p>
      <input type="button" value="修改count" onClick={changeCount} />
    </>
  );
}
